package cn.test.activemq.spring.consumer.queue;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

/**
 * @author Han
 */
@Component("spqueueconsumertest2")
public class SpringQueueReciverTest2 implements MessageListener{
	private static final Logger log = LoggerFactory.getLogger(SpringQueueReciverTest2.class);
	
	@Override
	public void onMessage(Message message) {
		System.out.println(message);
		if(message instanceof TextMessage){
			try {
				if(((TextMessage)message).getText().equals("eee")){
                    throw new JMSException("eeeee");
                }
			} catch (JMSException e) {
				e.printStackTrace();
			}
		}
	}
}
